package com.example.zhunongzonghe.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.zhunongzonghe.beans.ZnCollectFarmBean;
import com.example.zhunongzonghe.beans.ZnFarmproduceBean;
import com.example.zhunongzonghe.entity.ZnCollectFarm;

/**
* @author 蔡某人
* @description 针对表【zn_collect_farm】的数据库操作Service
* @createDate 2024-04-09 23:57:18
*/
public interface ZnCollectFarmService extends IService<ZnCollectFarm> {

    /**
     * 用户收藏农产品
     * @param znCollectFarmBean
     * @return
     */
    void addCollect(ZnCollectFarmBean znCollectFarmBean, String userName);

    /**
     * 帖子是否被收藏
     * @param farmId
     * @param userId
     * @return
     */
    Boolean isCollect(Integer farmId,Integer userId);

    /**
     * 获取当前帖子收藏数量
     * @param farmId
     * @return
     */
    Integer CollectCounts(Integer farmId);


    /**
     * redis同步收藏数据到MySql数据库
     */
    void syncFarmCollect();

    /**
     * 批量删除重复的帖子数据
     */
    void delRepetition();

    Page<ZnFarmproduceBean> MyCollects(String username, Integer currentPage, Integer pageSize);
}
